package com.bjut.vendormgrsys.model.repository;

import com.bjut.vendormgrsys.model.domain.CampaignUserPO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

public interface CampaignUserRepository extends JpaRepository<CampaignUserPO, String>, JpaSpecificationExecutor<CampaignUserPO> {

    CampaignUserPO findCampaignUserPOById(String id);

    CampaignUserPO findCampaignUserPOByUserIdAndCampaignIdAndUserType(String userId, String campaignId, String userType);

    List<CampaignUserPO> findAllByCampaignId(String campaignId);

    List<CampaignUserPO> findAllByCampaignIdAndType(String campaignId, String type);

    List<CampaignUserPO> findAllByUserId(String userId);

    List<CampaignUserPO> findAllByUserIdAndCampaignId(String userId,String campaignId);

    List<CampaignUserPO> findAllByUserIdAndCampaignIdAndIdNot(String userId,String campaignId, String id);

    List<CampaignUserPO> findAllByUserIdAndCampaignIdAndUserChildId(String userId,String campaignId,String userChildId);

}
